我想按照其他文件的特定顺序连接多个文件。
我有多个freq_<something>要连接的文件。“某物”列在另一个名为“列表”的文件中。
所以这是我的清单:
$ cat list
003137F
002980F
002993F
Run Code Online (Sandbox Code Playgroud)
我想要做:
cat freq_003137F freq_002980F freq_002993F > freq_all
Run Code Online (Sandbox Code Playgroud)
但是我的列表包含数百个值,所以我真的不能这样做!
有什么方法可以让它自动化?我以为我可以附加一个带有 a 的文件,while read line但它失败了...
谢谢!
米
我在 Linux 机器上有一组带有前缀的文件,比如“pre_”,我只想通过删除它来重命名所有这些文件。这是我编写的 perl 代码,它不会引发任何错误,但工作尚未完成。
#!/usr/bin/perl -w
my @files = `ls -1 | grep -i \"pre_.*\"`;
foreach $file ( @files )
{
my @names = split(/pre_/, $file);
my $var1 = $names[1];
'mv "$file" "$var1"';
}
Run Code Online (Sandbox Code Playgroud) 我们对文件使用数字版本控制(例如:report01.log.01、report01.log.02、report01.log.03 等)
我需要做的是生成每个文件的列表以及文件的版本数。
Linux 是否具有相对容易地执行此操作的功能?
在使用图形环境时确实很容易做到,但是当我使用 shell 时,我不知道如何做到这一点,我已经尝试使用copy, move, delete,并且我发现这些词在 shell 上不存在.
我有一个目录,其中包含名为“o1.ray”到“o293.ray”的文件。我想将它们移动到另一个目录,同时将它们重命名为“o132.ray”到“o424.ray”。
我如何在终端中执行此操作?
cd directory
for i in {1...293};
do cp o$i.ray subdirectory/o$i+131.ray;
done
Run Code Online (Sandbox Code Playgroud)
我知道这是错误的,因为我得到:
error message 'cp: cannot stat 'o{1...293}.ray': No such file or directory
Run Code Online (Sandbox Code Playgroud) 我正在学习有关如何在 OpenBSD 上安装固件的教程。本教程让我在 USB 上创建一个新的 msdos 文件系统,方法是:newfs_msdos -F 32 /dev/rsd2c然后将 USB 连接到具有互联网连接的系统,然后将固件 tarball 移动到 USB 中。我以前从未通过命令行将数据移动到 msdos fs。本教程展示了他在 manajaro 安装上使用 dolphin,但是我没有安装任何 gui 的系统。
如何将 tarball 移动到 USB 驱动器?
我尝试将其安装到已安装的目录中,但它不起作用。
陈述failed to preserve ownership for '/mnt2/iwn-firmwae.tgz': Operation not permitted
我的 Linux 计算机上的一个文件夹中有许多文件,名称如下:
11, 12, 13, 14, 15, 21, 22, 23, 24, 25, 31, 32, 33, 34, 35
Run Code Online (Sandbox Code Playgroud)
我想使用正则表达式以 .inp 扩展名重命名
我试过
mv * *.inp
mv: target '*.inp' is not a directory
Run Code Online (Sandbox Code Playgroud)
这提供了一个错误。我还尝试使用正则表达式 [123][12345] 而不是 *.
所以,我明白 mv 是用来移动文件的。我还想到也许我可以用来./*.inp 强制 mv 在同一个文件夹中写入,但它失败了。那么,除了不正确理解如何mv工作之外,我将如何继续完成这项工作mv?
我正在尝试编写一个 bash 脚本来删除 CentOS 上的部分文件名。我的文件名是:
119903_Relinked_new_3075_FileNote_07_02_2009_JHughes_loaMeetingAndSupport_FN_205.doc
119904_relinked_new_2206_Support_Intensity_Scale_SYCH_SIS_264549.pdf
119905_relinked_new_3075_Consent_07_06_2009_DSweet_CRFA_CF_16532.docx
29908_relinked_new_2206_Assessor_Summary_Report_SERT_I_OTH_264551.pdf
009712_relinked_new_3075_Consent_07_06_2009_CWell_DPRT_check_CF_16535.pdf
Run Code Online (Sandbox Code Playgroud)
我想119903_Relinked_new_从文件名中删除。最终结果应该是:
3075_FileNote_07_02_2009_JHughes_loaMeetingAndSupport_FN_205.doc
2206_Support_Intensity_Scale_SYCH_SIS_264549.pdf
3075_Consent_07_06_2009_DSweet_CRFA_CF_16532.docx
2206_Assessor_Summary_Report_SERT_I_OTH_264551.pdf
3075_Consent_07_06_2009_CWell_DPRT_check_CF_16535.pdf
Run Code Online (Sandbox Code Playgroud)
我一直在尝试多个脚本,但效果不佳。在大多数情况下,前面的数字_Relinked_new_是不同的,并且文件扩展名在 、 等之间有所不同。.pdf任何.docx帮助.doc将不胜感激。
如何删除多个-名称中包含多个文件夹的文件夹?
例如:
e97bf913-5759-4fff-bdaf-2f931b53a432/
39f953c5-dab0-420e-a650-a50a30f48097/
Run Code Online (Sandbox Code Playgroud) 文件名:
_10_-_Overriding_or_customizing_the_rest_end_point-rkkfgI502f0.mp4
_11_-_Expose_ids_in_json_response-CrDXtLfiZos.mp4
_12_-_Create_angular_8_project_using_Angular_CLI-kSXkW1hF0KU.mp4
_13_-_Create_a_model_class_for_Book_entity-Hfm3da1Ze8E.mp4
_14_-_Display_the_list_of_books_in_html_table_with_hard-coded_values-b5R8CsMrOO4.mp4
_15_-_Create_a_new_book-list_component_and_display_the_book_images-Tto3r229fFA.mp4
_16_-_Make_a_HTTP_GET_request_to_the_Spring_boot_application-98RfVQ9Z3ZM.mp4
_17_-_Understanding_the_Observable_and_Observer-NKLirs5SFYk.mp4
_18_-_Call_a_service_method_to_get_the_book_array-yQ34aPdH1_0.mp4
_19_-_Fix_the_error_CORS_policy_and_display_the_data_in_html_table-YSEAdODxMfE.mp4
_1_-_Course_Introduction-b4pjjftApmY.mp4
_20_-_Replace_the_blank_images_with_real_images-fut1f40FHo4.mp4
_2_-_Setup_the_development_environment-RbUGvRAUpSM.mp4
_3_-_Setup_the_MySQL_database-D3krImBhofo.mp4
_4_-_Create_repository_in_Github_and_add_it_to_Eclipse_IDE-MAkVtB_MhzI.mp4
_5_-_Create_spring_boot_project_using_spring_initializer-GsmqGxEv6rg.mp4
_6_-_Configure_application_properties_and_commit_changes_to_github-HqDZKih-Ehk.mp4
_7_-_Create_an_entity_class_for_book_table-pfxt3BeU_e0.mp4
_8_-_Create_an_entity_class_for_book_table-eg1pJJLAzAQ.mp4
_9_-_Create_rest_repositories_for_book_and_category_entity-w7vFTSCWCOM.mp4
Run Code Online (Sandbox Code Playgroud)
如何_从文件名的开头删除单个字符?
这很奇怪:
$ ls -l 'Lana Del Rey - Blue Jeans (Remastered 2011).mp3'
-rw-rw-r-- 1 gigi gigi 4.0M Dec 11 23:06 'Lana Del Rey - Blue Jeans (Remastered 2011).mp3'
$ find . -name 'Lana Del Rey - Blue Jeans (Remastered 2011).mp3'
./Lana Del Rey - Blue Jeans (Remastered 2011).mp3
# but still in the same directory:
$ find `pwd` -name 'Lana Del Rey - Blue Jeans (Remastered 2011).mp3'
# nothing found!
# directly using the path pointed by pwd will produce …Run Code Online (Sandbox Code Playgroud)