我想删除文件中带有单个字符的多个空格.例
cat kill rat
dog kill cat
Run Code Online (Sandbox Code Playgroud)
我使用了以下正则表达式,它似乎在http://www.regexpal.com/中匹配但在sed中不起作用.
([^ ])*([ ])*
Run Code Online (Sandbox Code Playgroud)
我像这样使用了sed命令:
sed s/\(\[\^\ \]\)*\(\[\ \]\)*/\$1\|/g < inputfile
Run Code Online (Sandbox Code Playgroud)
我预计,
cat|kill|rat
dog|kill|cat
Run Code Online (Sandbox Code Playgroud)
但我无法让它发挥作用.任何帮助将非常感激.谢谢.
编辑:请注意猫/狗可以是任何字符而不是空格.
我在创建我的Maven项目的RPM时收到以下错误.
我能够成功打包Jar但RPM创建失败.
注意:我正在尝试使用Windows 7
[WARNING] operable program or batch file.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 42.696 s
[INFO] Finished at: 2014-10-08T15:06:40+05:30
[INFO] Final Memory: 23M/228M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.0.1:rpm (default-cli) on project inv_project: RPM query for default vendor returned: '1' executing 'cmd.exe /X /C "rpm -E %{_host_vendor}"' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.0.1:rpm (default-cli) on project inv_project: RPM query for default vendor returned: '1' executing 'cmd.exe /X …Run Code Online (Sandbox Code Playgroud) 从某些 PDF 中提取文本时,PDFBox 会返回乱码。这是因为 Unicode 映射丢失或损坏。我可以在控制台上看到以下警告。我希望能够检测到这一点,以便能够将这些 PDF 标记为已损坏。
我正在寻找比解析日志更好的解决方案。
谢谢你的帮助!
示例控制台日志:
WARNING: No Unicode mapping for CID+32 (32) in font F6
WARNING: Failed to find a character mapping for 32 in TimesNewRoman,Bold
Run Code Online (Sandbox Code Playgroud)
下面提到的帖子也讨论了同样的问题,但没有讨论能够在代码端检测到这一点并处理相同问题的方法:使用 PDFBox 从 PDF 中读取一些 unicode 字符的问题
我想使用Traverson的Spring-Hateoas提供的休息服务,但是遇到以下问题,我在网络上找不到任何东西。我正在使用Spring-Boot 1.1.10.RELEASE。
我的客户呼叫如下所示:
...
final Traverson traverson = new Traverson(new URI("http://localhost:8080/bbsng-app-rest"), MediaTypes.HAL_JSON);
...
Run Code Online (Sandbox Code Playgroud)
我得到以下问题:
java.lang.NoClassDefFoundError: Could not initialize class org.springframework.hateoas.client.Traverson
at at.compax.bbsng.client.mvc.client.service.BerufServiceImpl.findeAlleBerufe(BerufServiceImpl.java:41)
at at.compax.bbsng.client.mvc.rest.controller.BerufController$1.call(BerufController.java:25)
at at.compax.bbsng.client.mvc.rest.controller.BerufController$1.call(BerufController.java:1)
at org.springframework.web.context.request.async.WebAsyncManager$4.run(WebAsyncManager.java:316)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:745)
Run Code Online (Sandbox Code Playgroud)
=====
相关配置:
POM:
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
<version>1.1.0.RELEASE</version>
</dependency>
...
Run Code Online (Sandbox Code Playgroud)
应用类别:
@Configuration
@EnableHypermediaSupport(type = HAL)
@EnableAutoConfiguration
public class ApplicationClientMvc {
public static void main(final String[] args) {
SpringApplication.run(ApplicationClientMvc.class, …Run Code Online (Sandbox Code Playgroud) 我有一个 tar 文件,其中有多个文件夹,如下所示:
code.tar
bin/
startup.sh
WebServer/
appname
webappname
Configuration/
a.properties
b.properties
Run Code Online (Sandbox Code Playgroud)
如果我解压缩 code.tar,我会得到一个文件夹名称code,其中包含其下的所有文件夹结构,但我想提取其中的内容code.tar并仅获取其下的子文件夹结构(即这些文件夹中的bin/、WebServer/和configuration/文件)。
当我使用时,tar -xzf code.tar -C <path> --strip-components=1我会获取子文件夹 ie 等的所有内容startup.sh以及appname子文件夹 -
例如,在运行上述命令时,我得到同一级别的所有这些文件夹和文件-
bin/
startup.sh
WebServer/
appname
webappname
Configuration/
a.properties
b.properties
Run Code Online (Sandbox Code Playgroud)
请帮忙